<?php

namespace iBrand\Component\Goods\Repositories\Eloquent;

use iBrand\Component\Goods\Models\Goods;
use iBrand\Component\Goods\Repositories\GoodsRepository;
use Prettus\Repository\Eloquent\BaseRepository;

class GoodsRepositoryEloquent extends BaseRepository implements GoodsRepository
{
	public function model()
	{
		return Goods::class;
	}

	public function getGoodsByGoodsNo($goods_no)
	{
		return $this->findWhere(['goods_no' => $goods_no, 'status' => 1])->first();
	}

	public function getGoodsByBarCode($bar_code)
	{
		return $this->findWhere(['goods_barcode' => $bar_code, 'status' => 1])->first();
	}

	public function getGoodsById($goods_id)
	{
		return $this->findWhere(['id' => $goods_id, 'status' => 0])->first();
	}
}